﻿
using Microsoft.EntityFrameworkCore;
using Model;
using System;
using System.Collections.Generic;
using System.Text;


namespace HotelDal
{
    public class MyDbcontext : DbContext
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer("Data Source=10.3.157.26;Initial Catalog=HotelManage;User ID=sa;Password=1234");
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Departments>().HasKey(c => c.Did);
            modelBuilder.Entity<Positions>().HasKey(c => c.Pid);
            modelBuilder.Entity<Staffs>().HasKey(c => c.STaffID);
            modelBuilder.Entity<Amusement>().HasKey(c => c.Aid);
            modelBuilder.Entity<Recreationlist>().HasKey(c => c.Rid);
            modelBuilder.Entity<Recreation>().HasKey(c => c.Rid);
            //客房订单
            modelBuilder.Entity<Guestroomorder>().HasKey(c => c.AId);
            modelBuilder.Entity<Guestroomtype>().HasKey(c => c.GId);
            //客房
            modelBuilder.Entity<RoomType>().HasKey(c => c.RTid);
            modelBuilder.Entity<RoomsModel>().HasKey(c => c.Rid);
            modelBuilder.Entity<RoomsList>().HasKey(c => c.Rid);
            modelBuilder.Entity<RoomList>().HasKey(c => c.Rid);
            //餐饮
            modelBuilder.Entity<DishLei>().HasKey(c => c.Id);
            modelBuilder.Entity<DishedInfo>().HasKey(c => c.Id);
            modelBuilder.Entity<DishesInfo>().HasKey(c => c.DishiId);
            modelBuilder.Entity<DishSalesInfo>().HasKey(c => c.DishedtokenId);
            //财务
            modelBuilder.Entity<HuiZone>().HasKey(c => c.HId);
            modelBuilder.Entity<ShouRu>().HasKey(c => c.SIId);
        }

        /// <summary>
        /// 客房订单
        /// </summary>
        public DbSet<Guestroomorder> Guestroomorder { get; set; }

        ///// <summary>
        ///// 客房类型
        ///// </summary>
        public DbSet<Guestroomtype> Guestroomtypes { get; set; }
        public DbSet<Departments> Departments { get; set; }
        public DbSet<Positions> Positions { get; set; }
        public DbSet<Staffs> Staffs { get; set; }
        public DbSet<Amusement> Amusement { get; set; }
        public DbSet<Recreation> Recreation { get; set; }
        public DbSet<Recreationlist> recreation { get; set; }
        public DbSet<DishedInfo> DishedInfo { get; set; }//点菜表
        public DbSet<DishesInfo> DishesInfo { get; set; }//菜品表
        public List<DishLei>  DishLei { get; set; }        //菜品类别表
        public DbSet<DishSalesInfo> DishSalesInfo { get; set; }//菜品销售表

        public DbSet<RoomType> RoomType { get; set; }//客房类型外键
        public DbSet<RoomsModel> RoomsModel { get; set; }//客房类型表
        public DbSet<RoomsList> roomsmodel { get; set; }//客房虚拟表
        public DbSet<RoomList> roomsModel { get; set; }//客房原来虚拟表

        public DbSet<ShouRu> shourus { get; set; } //财务收入表
        public DbSet<HuiZone> HuiZone { get; set; }//财务汇总表



    }
}
